package main

import (
	"GetUserInfo/handler"
	"GetUserInfo/model"
	pb "GetUserInfo/proto"
	"github.com/asim/go-micro/plugins/registry/consul/v3"
	service "github.com/asim/go-micro/v3"
	"github.com/asim/go-micro/v3/logger"
	"github.com/asim/go-micro/v3/registry"
)

func main() {
	// Create service
	consulReg := consul.NewRegistry(
		registry.Addrs("192.168.57.147:30098"),
	)
	srv := service.NewService(
		service.Name("go.micro.srv.GetUserInfo"),
		service.Version("latest"),
		service.Registry(consulReg),
		service.Address(":9984"),
	)
	srv.Init()
	model.InitDb()
	pb.RegisterGetUserInfoHandler(srv.Server(), new(handler.GetUserInfo))

	// Run service
	if err := srv.Run(); err != nil {
		logger.Fatal(err)
	}

}
